import Fly from 'flyio/dist/npm/wx'
import toast from '@/utils/toast.js'

const fly  = new Fly()

fly.config.baseURL = 'https://slwl-api.itheima.net'

// 添加请求拦截器
fly.interceptors.request.use(config => {
	return config
})

// 添加响应拦截器
fly.interceptors.response.use(response => {
	return response.data
}, err => {
	toast.err(err.message)
	return Promise.reject((err))
})

export default fly